package com.deane.webservice.endpoint.claim;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.deane.webservice.model.AclaimsClaimdata;
import com.deane.webservice.service.IAclaimsClaimdataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;

import java.util.List;

@Endpoint
public class ClaimEndpoint {
    private static final String NAMESPACE_URI = "http://max/claim";
    @Autowired
    IAclaimsClaimdataService aclaimsClaimdataService;

    @PayloadRoot(namespace = NAMESPACE_URI, localPart = "request")
    @ResponsePayload
    public Response getClaimDate(@RequestPayload Request request) {
        List<AclaimsClaimdata> aclaimsClaimdataList = aclaimsClaimdataService
                .list(new QueryWrapper<AclaimsClaimdata>().eq("cCD_ClaimCode", request.getcCD_ClaimCode()));
        Response response = new Response();
        response.setData(aclaimsClaimdataList);
        return response;
    }
}
